<template>
  <div>
    <van-address-list
      v-model="chosenAddressId"
      :list="list"
      :disabled-list="disabledList"
      disabled-text="以下地址超出配送范围"
      default-tag-text="默认"
      @add="onAdd"
      @edit="onEdit"
    />

 <!-- --------------------- -->
<!-- 地址编辑组件 -->

  </div>
</template>

<script>
import { Toast } from "vant";
import {mapMutations, mapState} from "vuex"
export default {
  data() {
    return {
      chosenAddressId: "1",
     
      disabledList: [
        {
          id: "3",
          name: "王五",
          tel: "1320000000",
          address: "浙江省杭州市滨江区江南大道 15 号",
        },
      ],
    };
  },
  methods: {
    ...mapMutations(['delAddress']),
    onAdd() {
      Toast("新增地址");
      this.$router.push("/address1")
    },
    onEdit(item, index) {
      Toast("编辑地址:" + index);
      this.$router.push({
          path: '/address1',
          query: {
              index,
              item
              // url的参数, 类似get请求的传参
              
          },
      })
    },
    fn(item,index){
        console.log(index)
        this.delAddress(index)
    }
  },
  computed:{
      ...mapState(["list"])
  }
};
</script>

<style>
</style>